/* File Info
 * Author:      李佳乐
 * CreateTime:  2024/1/4 16:07:55
 * LastEditor:  李佳乐
 * ModifyTime:  2024/1/4 17:06:25
 * Description:
 * 偏特化分为两种，一种是范围特化:将任意T改写成T的指针，从而缩小范围；
 * 一种是参数特化，将某一些参数(必须是从左到右，不能跳)特化为某种特定类型
 */
#ifndef __PARTIALSPECIALIZATION__
#define __PARTIALSPECIALIZATION__

#include <iostream>
using namespace std;

template <typename T, typename U>
class particalSpecialization
{
private:
    T data1;
    U data2;

public:
    particalSpecialization(const T &arg1, const U &arg2) : data1(arg1), data2(arg2) {}
    void show() { cout << "T1: " << data1 << " T2: " << data2 << endl; }
};

template <typename U>
class particalSpecialization<int, U>
{
private:
    int data1;
    U data2;

public:
    particalSpecialization(const int &arg1, const U &arg2) : data1(arg1), data2(arg2) {}
    void show() { cout << "partial T1: " << data1 << " T2: " << data2 << endl; }
};

template <typename T>
class ptclSpec2
{
private:
    T data;

public:
    ptclSpec2(const T &args) : data(args){};
    void show() { cout << "data: " << data << endl; }
};

template <typename T>
class ptclSpec2<T *>
{
private:
    T *data;

public:
    ptclSpec2(const T *args)
    {
        data = new T();
        *data = *args;
    };
    ~ptclSpec2() { delete (data); }
    void show() { cout << "point type data: " << *data << endl; }
};
#endif